package com.guigu.qingcheng.controller;

import com.guigu.common_util.pojo.utils.Result;
import com.guigu.qingcheng.entity.TbUser;
import com.guigu.qingcheng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class RegisterController {

    @Autowired
    private UserService userService;

    //转用户注册页面
    @RequestMapping("/register")
    public String register() {
        return "register";
    }

    @GetMapping("/sendSms")
    @ResponseBody
    public Result sendSms(String phone) {
        System.out.println(phone);
        return userService.sendMsm(phone);
    }

    @PostMapping("/save")
    @ResponseBody
    public Result save(@RequestBody TbUser user,String smsCode){
        return userService.save(user,smsCode);
    }

}
